/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package tesauro;

import java.io.Serializable;

/**
 *
 * @author Marcelo
 */
public class LlaveDiccionario implements Serializable{
    String palabra;
    IHashCodeStrategy hashCodeStrategy;
    
    public LlaveDiccionario(IHashCodeStrategy hashCodeStrategy){
        this.hashCodeStrategy = hashCodeStrategy;
    }
    
    public int hashCode(){
        return hashCodeStrategy.hash(palabra);
    }
    
    public void setPalabra(String palabra){
        this.palabra = palabra;
    }

    public IHashCodeStrategy getHashCodeStrategy() {
        return hashCodeStrategy;
    }

    public void setHashCodeStrategy(IHashCodeStrategy hashCodeStrategy) {
        this.hashCodeStrategy = hashCodeStrategy;
    }
        
    public String getPalabra(){
        return palabra;
    }
    
   public boolean equals(Object o) {
        if(o == null || !(o instanceof LlaveDiccionario)) {
            return false;
        }
        
        if(o == this) {
            return true;
        }
        
        return ((LlaveDiccionario)o).palabra.equals(palabra);
    }
}
